import request from '@/utils/http'

/**
 * 获取活动列表API
 *
 * @param params 查询参数对象
 * @returns 返回Promise对象，解析后为活动列表对象
 */
export const eventListApi = (params: any) => {
  return request.get('/api/event', { params })
}

/**
 * 获取活动详情API
 *
 * @param eid 活动ID
 * @returns 返回Promise对象，解析后为活动详情对象
 */
export const eventDetailApi = (eid: string, action: string) => {
  return request.get(`/api/event/${eid}?action=${action}`)
}

/**
 * 新增活动API
 *
 * @param data 活动数据对象
 * @returns 返回Promise对象
 */
export const eventAddApi = (data: any) => {
  return request.post('/api/event', data)
}

/**
 * 更新活动API
 *
 * @param eid 活动ID
 * @param data 活动数据对象
 * @returns 返回Promise对象
 */
export const eventUpdateApi = (eid: string, data: any) => {
  return request.put(`/api/event/${eid}`, data)
}

/**
 * 删除活动API
 *
 * @param eid 活动ID
 * @returns 返回Promise对象
 */
export const eventDeleteApi = (eid: string) => {
  return request.delete(`/api/event/${eid}`)
}